package com.huawei.statistics.service.impl.admin;

import com.huawei.statistics.pojo.admin.Admin;
import com.huawei.statistics.service.admin.AdminService;
import com.huawei.statistics.service.impl.common.BaseServiceImpl;
import com.huawei.statistics.vo.common.HttpResult;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 18573 on 2019/1/14.
 */

@Service
public class AdminServiceImpl extends BaseServiceImpl implements AdminService {

    @Override
    public HttpResult loginAdmin(String name, String password) {
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        map.put("password",password);
        List<Admin> list = getEntityByMap(Admin.class,map);
        if(list == null){
            return new HttpResult(HttpResult.NULL,false);
        }else if(list.size() > 0){
            return new HttpResult(HttpResult.OK,true);
        }
        return new HttpResult(HttpResult.NULL,false);
    }
}
